﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverApp.ViewModel.OperationsFile
{
    public class UploadViewModel : ViewModelBase
    {
        private MainPageViewModel parent = null;
        private ICommand sendFile;
        private string pathFile;

        public UploadViewModel(MainPageViewModel prt)
        {
            parent = prt;
            sendFile = new RelayCommand(SendFileCommand, CanSendFile);
        }

        public ICommand SendFile
        {
            get { return sendFile; }
            set { sendFile = value; }
        }

        public string PathFile
        {
            get { return pathFile;}
            set 
            {
                if (pathFile != value)
                {
                    pathFile = value;
                    OnPropertyChanged("PathFile");
                }
            }
        }

        public void SendFileCommand(object parameter)
        { 
            
        }

        public bool CanSendFile(object parameter)
        { 
            // TODO check format of file 
            return true;
        }


        public void LookingForFile()
        {
            OpenFileDialog dialogFile = new OpenFileDialog();
            bool? ret = dialogFile.ShowDialog();
            if (ret != null && ret == true)
            {
                PathFile = dialogFile.File.FullName;
            }
        }
    }
}
